
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>RabbitMQ延时插件 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>RabbitMQ延时插件 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在RabbitMQ中，如何通过命令行启用 `rabbitmq_delayed_message_exchange` 插件？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过在RabbitMQ容器内执行命令 `rabbitmq-plugins enable rabbitmq_delayed_message_exchange` 来启用该插件。</div>
          </div>
          <div class="card-source">来源: 安装</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">在使用Spring AMQP配置延迟消息交换机时，需要为其指定哪两个关键属性？它们分别是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要指定交换机的类型为 `x-delayed-message` 和一个名为 `x-delayed-type` 的参数。例如，在代码中，`x-delayed-type` 被设置为 `direct`，用于定义消息路由的行为。</div>
          </div>
          <div class="card-source">来源: 实现</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">当发送一条消息到 `rabbitmq_delayed_message_exchange` 交换机时，如何设置其延迟时间？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过在消息的 `MessageProperties` 中设置一个名为 `x-delay` 的头（header），其值代表延迟的毫秒数。</div>
          </div>
          <div class="card-source">来源: 实现</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">相较于传统的TTL模式，`rabbitmq-delayed-message-exchange` 插件模式在处理延迟消息时有何核心不同？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">核心不同点在于消息的存储位置。延迟插件是将消息存储在交换机（exchange）中，而传统TTL模式是将消息存储在队列（queue）中。这使得插件模式下的消息到期后即可被消费，不会被队列中未到期的消息阻塞。</div>
          </div>
          <div class="card-source">来源: 插件模式</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">如何验证 `rabbitmq_delayed_message_exchange` 插件是否已成功安装并生效？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以登录RabbitMQ的管理界面，在Exchanges页面下的“Type”下拉列表中查看是否存在 `x-delayed-message` 这一类型。如果存在，则表示插件已生效。</div>
          </div>
          <div class="card-source">来源: 安装</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">为什么延迟插件模式能够确保消息在到期后立即被消费，而不会像TTL模式那样被阻塞？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">因为延迟插件将消息保存在交换机中进行管理。当消息的延迟时间到达后，交换机才将该消息路由到绑定的队列。这种机制绕开了队列先进先出的限制，避免了先入队但延迟时间更长的消息阻塞后面即将到期的消息。</div>
          </div>
          <div class="card-source">来源: 插件模式</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
